<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>v-for</title>
</head>
<body>
    <div id="app">
        <input type="button" value="添加数据" @click="add">
        <input type="button" value="减少数据" @click="remove">
        <ul>
            <li v-for="item in arr">hello</li>
        </ul>
        <ul>
            <li v-for="item in arr" :title="item" >hello</li>
        </ul>
        <ul>
            <li v-for="item in arr" v-text="item" ></li>
        </ul>

        <ul>
            <li v-for="(item,index) in arr">{{item}} {{index}}</li>
        </ul>
        <ul>
            <li v-for="item in objArr">{{item.name}}</li>
        </ul>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script>
        let app = new Vue({
            el:"#app",
            data:{
                arr:[1,2,3,4,5],
                objArr:[
                    {name:"张三"},
                    {name:"李四"}
                ]
            },
            methods:{
                add:function () {
                    this.arr.push(6);
                },
                remove:function () {
                    this.arr.shift();
                }
            }
        })
    </script>
</body>
</html>